<!--
  ~ MIT License
  ~
  ~ Copyright (c) 2021-2022 yangrunkang
  ~
  ~ Author: yangrunkang
  ~ Email: yangrunkang53@gmail.com
  ~
  ~ Permission is hereby granted, free of charge, to any person obtaining a copy
  ~ of this software and associated documentation files (the "Software"), to deal
  ~ in the Software without restriction, including without limitation the rights
  ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  ~ copies of the Software, and to permit persons to whom the Software is
  ~ furnished to do so, subject to the following conditions:
  ~
  ~ The above copyright notice and this permission notice shall be included in all
  ~ copies or substantial portions of the Software.
  ~
  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  ~ SOFTWARE.
  -->

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      th:replace="index">
<!--css-->
<link th:fragment="css" type="text/css" rel="stylesheet" th:href="${ossStatic} + @{/css/user/manage/upload-profile-photo.css}" />
<!--脚本-->
<script th:fragment="js" type="text/javascript" th:src="${ossStatic} +@{/js/user/manage/upload-profile-photo.js}"></script>

<!--加载图片裁剪插件-->
<link th:fragment="css" type="text/css" rel="stylesheet" th:href="${ossStatic} + @{/js/cropper.min.css}" />
<script th:fragment="js" type="text/javascript" th:src="${ossStatic} + @{/js/cropper.min.js}"></script>

<div th:fragment="content">
    <!--收藏夹-->
    <div class="container">
        <div class="row g-2">
            <!--右列-->
            <div class="col-lg-9 mb-2">
                <div class="card border-0 rounded-3 p-2 mb-2">
                    <div th:replace="fragments/manage::user_settings('uploadUserVia')"></div>
                    <div class="container mb-3">
                        <div th:if="!${#strings.isEmpty(memberIndexDto.memberEnhance.member.via)}" class="d-block text-center">
                            <img class="lazyload rounded" style="width: 90px;height: 90px" id="avatar" th:data-src="${memberIndexDto.memberEnhance.member.via}" alt="avatar">
                        </div>


                        <label class="label d-block text-center mt-3" data-bs-toggle="tooltip" title="更换头像">
                            <input type="file" class="sr-only" style="display: none" id="input" name="image" accept="image/*">
                            <div class="btn rounded-3 bg-gradient btn-outline-secondary btn-sm">更换头像</div>
                        </label>
                        <div class="alert" role="alert"></div>
                        <div class="modal fade" id="modal"
                             tabindex="1"
                             role="dialog"
                             aria-labelledby="modalLabel"
                             aria-hidden="true"
                             data-bs-keyboard="false"
                             data-bs-backdrop="static"
                        >
                            <div class="modal-dialog" role="document">
                                <div class="modal-content border-0 shadow-lg">
                                    <div class="modal-header">
                                        <h5 class="crop-title">裁剪头像</h5>
                                        <button type="button" class="btn rounded-3 bg-gradient-close" data-bs-dismiss="modal" aria-label="Close">

                                        </button>
                                    </div>
                                    <div class="modal-body" style="overflow:hidden;"  >
                                        <div class="img-container">
                                            <img id="image" th:src="${ossStatic} + @{/system/profile-photo.png}">
                                        </div>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="ui button" data-bs-dismiss="modal">取消</button>
                                        <button type="button" class="ui primary button" id="crop">上传</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div th:if="!${#lists.isEmpty(memberIndexDto.memberEnhance.historyViaList)}">
                        <div class="border-bottom"></div>
                        <div class="lead mb-2 text-black-50">历史头像</div>
                        <div style="display: inline-block" class="border-0 rounded m-2 px-2 pt-2 pb-1" th:each="historyVia : ${memberIndexDto.memberEnhance.historyViaList}">
                            <img class="lazyload rounded" style="width: 90px;height: 90px" th:data-src="${historyVia}" />
                            <div class="text-center">
                                <button class="btn rounded-3 bg-gradient btn-outline-secondary btn-sm mt-1" th:onclick="selectVia([[${historyVia}]])">选择</button>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
            <!--左列-用户信息-->
            <div class="col-lg-3">
                <div th:include="fragments/index::user_index_left"></div>
            </div>
        </div>
    </div>
</div>
</html>
